home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / backup / tob-0.13 / tob-0 / tob / doc / afio.txt next >
Text File  |  1995-07-13  |  21KB  |  485 lines

  1.  
  2. AFIO(1)                                                   AFIO(1)
  3.  
  4. NAME
  5.        afio - manipulate archives and files
  6.  
  7. SYNOPSIS
  8.        ...  | afio -o [ options ] archive  : write archive
  9.        afio -i [ options ] archive  : install archive
  10.        afio  -t  [ options ] archive  : list table-of-contents of
  11.        archive
  12.        afio -r [ options ]  archive   :  verify  archive  against
  13.        filesystem
  14.        afio -p [ options ] directory [ ... ] : copy files
  15.  
  16.        Frequently used options:
  17.        -v -Z -F -K -n
  18.        -s volsize -b blocksize -y pattern -Y pattern
  19.  
  20. DESCRIPTION
  21.        Afio  manipulates groups of files, copying them within the
  22.        (collective) filesystem or between the filesystem  and  an
  23.        afio  archive.  Note  that  afio archives are portable, as
  24.        they contain only ASCII-formatted header information. They
  25.        are  also compatible with ASCII cpio(1) archives (ala cpio
  26.        -c, for GNU cpio(1) also cpio -H odc).
  27.  
  28.        With -o, reads  pathnames  from  the  standard  input  and
  29.        writes an archive.
  30.  
  31.        With  -t,  reads an archive and writes a table-of-contents
  32.        to the standard output.
  33.  
  34.        With -i, installs the contents of an archive  relative  to
  35.        the working directory.
  36.  
  37.        With  -p,  reads  pathnames  from  the  standard input and
  38.        copies the files to each directory.
  39.  
  40.        With  -r,  reads  archive  and  verifies  it  against  the
  41.        filesystem.  This is useful for verifying tape archives.
  42.  
  43.        Creates missing directories as necessary, with permissions
  44.        to match their parents.
  45.  
  46.        Generates sparse filesystem blocks  (with  lseek(2))  when
  47.        possible.
  48.  
  49.        Removes leading slashes from pathnames when reading, writ-
  50.        ing, and cataloging an archive, unless instructed not  to.
  51.  
  52.        Supports  multi-volume  archives during interactive opera-
  53.        tion (i.e., when /dev/tty is accessible and SIGINT is  not
  54.        being ignored).
  55.  
  56.                                                                 1
  57.  
  58. AFIO(1)                                                   AFIO(1)
  59.  
  60. OPTIONS
  61.        -b size      Read  or write size-character archive blocks.
  62.                     Suffices of b, k and m  denote  multiples  of
  63.                     512,    1024   and   1048576,   respectively.
  64.                     Defaults  to  5120  for  compatibility   with
  65.                     cpio(1).
  66.  
  67.        -c count     Buffer count archive blocks between I/O oper-
  68.                     ations. A large  count  is  recommended  with
  69.                     streaming magnetic tape drives.
  70.  
  71.        -d           Don't create missing directories.
  72.  
  73.        -e bound     Pad  the archive to a multiple of bound char-
  74.                     acters.  Recognizes the same suffices as  -s.
  75.                     Defaults  to  1x (the -b block size) for com-
  76.                     patibility with cpio(1).
  77.  
  78.        -f           Spawn a child process to  actually  write  to
  79.                     the  archive;  provides a clumsy form of dou-
  80.                     ble-buffering.  Requires -s for  multi-volume
  81.                     archive support.
  82.  
  83.        -g           Change  to  input  file  directories.  Avoids
  84.                     quadratic filesystem behavior with long simi-
  85.                     lar  pathnames.  Requires  all absolute path-
  86.                     names, including those for the -o archive and
  87.                     the -p directories.
  88.  
  89.        -h           Follow symbolic links, treating them as ordi-
  90.                     nary files and directories.
  91.  
  92.        -j           Don't generate sparse filesystem blocks.
  93.  
  94.        -k           Skip corrupt data  at  the  beginning  of  an
  95.                     archive (rather than complaining about unrec-
  96.                     ognizable input).
  97.  
  98.        -l           With -o, write file contents with  each  hard
  99.                     link.
  100.  
  101.                     With -t, report hard links.
  102.  
  103.                     With  -p,  attempt  to link files rather than
  104.                     copying them.
  105.  
  106.        -m           Mark  output  files  with  a  common  current
  107.                     timestamp  (rather than with input file modi-
  108.                     fication times).
  109.  
  110.        -n           Protect newer existing files (comparing  file
  111.                     modification times).
  112.  
  113.                                                                 2
  114.  
  115. AFIO(1)                                                   AFIO(1)
  116.  
  117.        -s limit     Restrict   each  portion  of  a  multi-volume
  118.                     archive to limit characters.  Recognizes  the
  119.                     same  suffices  as  -b.   Also,  the suffix x
  120.                     denotes a multiple of the -b block size  (and
  121.                     must  follow  any  -b specification).  Useful
  122.                     with  finite-length  devices  which  do   not
  123.                     return  short  counts at end of media (sigh);
  124.                     output to magnetic tape typically falls  into
  125.                     this  category.    When  an  archive is being
  126.                     read, using -s causes afio to prompt for  the
  127.                     next  disk  if the specified volume length is
  128.                     reached.  The -s  will  also  cause  afio  to
  129.                     prompt  if  there  is  a  premature EOF while
  130.                     reading the input.  The  special  case  -s  0
  131.                     will  activate  this  prompting  for the next
  132.                     disk on EOF without setting a volume  length.
  133.  
  134.        -u           Report files with unseen links.
  135.  
  136.        -v           Verbose.  Report  pathnames  as they are pro-
  137.                     cessed. With -t, gives an ls -l style  report
  138.                     (including link information).
  139.  
  140.        -w filename  Treats  each  line  in filename as an -y pat-
  141.                     tern, see -y.
  142.  
  143.        -x           Retain file ownership and setuid/setgid  per-
  144.                     missions.  This is the default for the super-
  145.                     user; he may use -X to override it.
  146.  
  147.        -y pattern   Restrict processing of archive read to  names
  148.                     matching shell pattern pattern.  Specify once
  149.                     for each pattern to be recognized.  Use -Y to
  150.                     supply  patterns  which  are  not  to be pro-
  151.                     cessed.   -Y  overrides  -y  if  a   filename
  152.                     matches both.  Unless the -S option is given,
  153.                     leading slashes  are  ignored  when  matching
  154.                     patterns,     e.g.     /etc/passwd    matches
  155.                     etc/passwd.  See also -w and -W.
  156.  
  157.        -z           Print execution statistics. This is meant for
  158.                     human  consumption;  use by other programs is
  159.                     officially discouraged.
  160.  
  161.        -A     Do not turn absolute  paths  into  relative  paths.
  162.               That is don't remove the leading slash.
  163.  
  164.        -B     If the -v option is used, prints the byte offset of
  165.               the start of each file in  the  archive.   If  your
  166.               tape  drive can start reading at any position in an
  167.               archive, the output of -B can be useful  for  doing
  168.  
  169.                                                                 3
  170.  
  171. AFIO(1)                                                   AFIO(1)
  172.  
  173.               quick selective restores.
  174.  
  175.        -D controlscript
  176.               Set  the  control script name to controlscript, see
  177.               the section on control files below.
  178.  
  179.        -E filename
  180.               Read file extensions, separated by whitespace, from
  181.               filename.   Files  with these extensions are not to
  182.               be compressed when using the -Z  option.   filename
  183.               may  contain comments preceded by a #.  If no -E is
  184.               given, files with the extensions  .Z  .z  .gz  .arc
  185.               .gif  .zip  .zoo .lha .jpeg .jpg .tpz .taz .tgz and
  186.               .tzg will not be compressed.
  187.  
  188.        -F     This is a floppy  disk,  -s  is  required.   Causes
  189.               floppy  writing  in  O_SYNC mode under Linux.  With
  190.               kernel version 1.1.54 and above, this  allows  afio
  191.               to  detect  some floppy errors while writing.  Uses
  192.               shared memory if compiled in otherwise  mallocs  as
  193.               needed (a 3b1 will not be able to malloc the needed
  194.               memory w/o shared memory), afio assumes either  way
  195.               you can malloc/shmalloc a chunck of memory the size
  196.               of one disk. Examples:  795k:  3.5"  (720k  drive),
  197.               316k (360k drive)
  198.               At the end of each disk this message occurs:
  199.                Ready for disk [#] on [output]
  200.                                      (remove the disk when the light goes out)
  201.                Type "go" (or "GO") when ready to proceed (or "quit" to abort):
  202.  
  203.        -G factor
  204.               Specifies  the  gzip(1)  compression  speed factor,
  205.               used when compressing files  with  the  -Z  option.
  206.               Factor  1  is the fastest with least compression, 9
  207.               is slowest  with  best  compression.   The  default
  208.               value  is 6.  See also the gzip(1) manual page.  If
  209.               you have a slow machine or a  fast  backup  medium,
  210.               you  may  want to specify a low value for factor to
  211.               speed up the backup.  On large (>200k) files, -G  1
  212.               typically  zips  twice as fast as -G 6, while still
  213.               achieving a better result  than  compress(1).   The
  214.               zip  speed  for small files is mainly determined by
  215.               the invocation time of gzip (1), see the -T option.
  216.  
  217.        -K     Verify  the  output  against  what is in the memory
  218.               copy of the disk (-F required).  If the writing  or
  219.               verifying fails the following menu pops up
  220.                   [Writing/Verify] of disk [disk #] has FAILED!
  221.                    Enter 1 to RETRY this disk
  222.                    Enter 2 to REFORMAT this disk before a RETRY
  223.  
  224.                    Enter quit to ABORT this backup
  225.  
  226.                                                                 4
  227.  
  228. AFIO(1)                                                   AFIO(1)
  229.  
  230.               Currently,  afio will not process the answers 1 and
  231.               2 in the right way.  The menu above is only  useful
  232.               in that it signifies that something is wrong.
  233.  
  234.        -L Log_file_path
  235.               Specify  the name of the file to log errors and the
  236.               final totals to.
  237.  
  238.        -M size
  239.               Specifies the maximum amount of memory to  use  for
  240.               the  temporary  storage of compression results when
  241.               using the -Z  option.  The  default  is  -M  2m  (2
  242.               megabytes).  If the compressed version of a file is
  243.               larger than this (or if afio runs  out  of  virtual
  244.               memory),  gzip(1)  is  run  twice  of the file, the
  245.               first time to determine the length of  the  result,
  246.               the  second time to get the compressed data itself.
  247.  
  248.        -R Disk format command string
  249.               This is the command that is run when you enter 2 to
  250.               reformat  the  disk.   The  default  (/bin/fdformat
  251.               /dev/fd0H1440) can be changed to a  given  system's
  252.               default by editing the Makefile.
  253.  
  254.        -S     Do  not ignore leading slashes when matching -y and
  255.               -Y patterns. See also -A.
  256.  
  257.        -T threshold
  258.               Only compress a file when using the  -Z  option  if
  259.               its  length  is at least threshold.  The default is
  260.               -T 0k.  This is useful if you have a  slow  machine
  261.               or  a  fast  backup medium.  Specifying -T 3k typi-
  262.               cally halves the number of invocations of  gzip(1),
  263.               saving some 30% computation time, while creating an
  264.               archive that is only 5% longer.  The combination -T
  265.               8k  -G  1  typically saves 70% computation time and
  266.               gives a 20% size increase.  The latter  combination
  267.               may  be  a good alternative to not using -Z at all.
  268.               These figures of course depend heavily on the  kind
  269.               of  files  in  the  archive and the processor - i/o
  270.               speed ratio on your machine.
  271.  
  272.        -W filename
  273.               Treats each line in filename as an -Y pattern,  see
  274.               -y.
  275.  
  276.        -Y pattern
  277.               See -y.
  278.  
  279.        -Z     Gzip  the  files  on  the  way out, in, and passing
  280.               without links (valid w/ or w/o -F or -K),  requires
  281.               gzip(1) to be in your path.
  282.  
  283.                                                                 5
  284.  
  285. AFIO(1)                                                   AFIO(1)
  286.  
  287. NOTES
  288.        Special-case archive names:
  289.  
  290.           o  Specify  -  to  read  or write the standard input or
  291.              output, respectively.   This  disables  multi-volume
  292.              archive handling.
  293.  
  294.           o  Prefix  a  command  string  to  be  executed with an
  295.              exclamation mark (!).  The command is executed  once
  296.              for  each archive volume, with its standard input or
  297.              output piped to afio.  It is expected to  produce  a
  298.              zero exit code when all is well.
  299.  
  300.           o  Use system:file to access an archive in file on sys-
  301.              tem.  This is really just a special case of pipelin-
  302.              ing.    It  requires  a  4.2BSD-style  remote  shell
  303.              (rsh(1C)) and a remote copy of afio.
  304.  
  305.           o  Anything else specifies a local file or device.   An
  306.              output  file  will be created if it does not already
  307.              exist.
  308.  
  309.        Recognizes obsolete  binary  cpio(1)  archives  (including
  310.        those  from machines with reversed byte order), but cannot
  311.        write them.
  312.  
  313.        Recovers from archive corruption by searching for a  valid
  314.        magic  number. This is rather simplistic, but, much like a
  315.        disassembler, almost always works.
  316.  
  317.        Optimizes pathnames with respect to the current and parent
  318.        directories.  For example, ./src/sh/../misc/afio.c becomes
  319.        src/misc/afio.c.
  320.  
  321. CONTROL FILES
  322.        Afio archives can contain so-called control files.  Unlike
  323.        normal  archive entries, a control file in not unpacked to
  324.        the filesystem.  A control file has a label and some data.
  325.        When  afio  encounters a control file in the archive it is
  326.        reading, it will feed the label and data  to  a  so-called
  327.        control  script.   The  control  script is supplied by the
  328.        user.  It can perform special actions based on  the  label
  329.        and data it receives from afio.
  330.  
  331.        Control  file  labels.   The control file mechanism can be
  332.        used  for  many  things.   Examples  are  putting  archive
  333.        descriptions at the beginning of the archive and embedding
  334.        lists of files to move before unpacking the  rest  or  the
  335.        archive.
  336.  
  337.        To distinguish between different uses, the label of a con-
  338.        trol file should indicate the program that made the contol
  339.  
  340.                                                                 6
  341.  
  342. AFIO(1)                                                   AFIO(1)
  343.  
  344.        file  and the purpose of the control file data.  It should
  345.        have the form
  346.  
  347.           programname.kindofdata
  348.  
  349.        where programname is the name of the backup  program  that
  350.        generated  the control file, and kindofdata is the meaning
  351.        of the control file data.  Some examples are
  352.  
  353.           tbackup.movelist  tbackup.updatescript
  354.           blebberfiler.archivecontents
  355.           backup_script_of_Joe_User.archivedescription
  356.  
  357.        The user-supplied control script should look at the  label
  358.        to  decide  what  to  do with the control data.  This way,
  359.        control files with unknown labels can be ignored, and afio
  360.        archives  maintain some degree of portability between dif-
  361.        ferent programs that restore or index them.
  362.  
  363.        Control file labels  that  are  intended  to  be  portable
  364.        between  different backup programs could be defined in the
  365.        future.
  366.  
  367.        Making control files.  When making an archive, afio  reads
  368.        a  stream  containing the names of the files (directories,
  369.        ...) to put in the archive.  This stream may also  contain
  370.        `control  file  generators', which are lines with the fol-
  371.        lowing format:
  372.  
  373.            //--sourcename label
  374.  
  375.        Here, the //-- sequence signals that a control file is  to
  376.        be  made,  sourcename is the path to a file containing the
  377.        control file data, and label is the  control  file  label.
  378.        The  sourcename  must  be a regular file or a symlink to a
  379.        regular file.
  380.  
  381.        A control file will show up as
  382.  
  383.           //--CONTROL_FILE/label
  384.  
  385.        in an archive listing, where label  is  the  control  file
  386.        label.
  387.  
  388.        Control  scripts.   A  control  script is supplied to afio
  389.        with the
  390.  
  391.          -D controlscript
  392.  
  393.        command line option.  The controlscript must  be  an  exe-
  394.        cutable  program.  The script is run whenever afio encoun-
  395.        ters a control file while doing a -i -t or  -r  operation.
  396.  
  397.                                                                 7
  398.  
  399. AFIO(1)                                                   AFIO(1)
  400.  
  401.        Afio  will supply the control file label as an argument to
  402.        the script.  The script should read the control file  data
  403.        from  its standard input.  If the script exits with a non-
  404.        zero exit status, afio will issue a warning message.
  405.  
  406.        If a contol file is encountered and no -D option is given,
  407.        afio  will issue a warning message.  To suppress the warn-
  408.        ing message and ignore all control scripts, -D ""  can  be
  409.        used.
  410.  
  411.        An example of a control script is
  412.  
  413.          #!/bin/sh
  414.          if [ $1 = "afio_example.headertext" ]; then
  415.            #the headertext control file is supposed to be packed as the first
  416.            #entry of the archive
  417.            echo Archive header:
  418.            cat -
  419.            echo Unpack this archive? y/n
  420.            #stdout is still connected to the tty, read the reply from stdout
  421.            read yn <&1
  422.            if [ "$yn" = n ]; then
  423.              #abort
  424.              kill $PPID
  425.            fi
  426.          else
  427.            echo Ignoring unknown control file.
  428.            cat - >/dev/null
  429.          fi
  430.  
  431.        Afio  never  compresses the control file data when storing
  432.        it in an archive, even when the -Z option is used.  When a
  433.        control  file  is encountered by cpio(1) or an afio with a
  434.        version number below 2.4.1, the data will be  unpacked  to
  435.        the  filesystem,  and named CONTROL_FILE/label where label
  436.        is the control file label.
  437.  
  438. BUGS
  439.        There are too many options.
  440.  
  441.        Restricts pathnames to 1023 characters and 255  meaningful
  442.        elements.
  443.  
  444.        There  is  no  sequence  information  within  multi-volume
  445.        archives.  Input sequence errors generally  masquerade  as
  446.        data  corruption.   A  solution would probably be mutually
  447.        exclusive with cpio(1) compatibility.
  448.  
  449.        Degenerate uses of symbolic links are mangled by  pathname
  450.        optimization.   For  example, assuming that "usr.src" is a
  451.        symbolic    link    to    "/usr/src",     the     pathname
  452.        "usr.src/../bin/cu" is mis-optimized into "bin/cu" (rather
  453.  
  454.                                                                 8
  455.  
  456. AFIO(1)                                                   AFIO(1)
  457.  
  458.        than "/usr/bin/cu").
  459.  
  460.        The Linux floppy drivers below kernel  version  1.1.54  do
  461.        not allow afio to find out about floppy write errors while
  462.        writing.  If you are running a kernel below  1.1.54,  afio
  463.        will happily fail to write to (say) a write protected disk
  464.        and not report anything wrong!  The only way to  find  out
  465.        about  write errors in this case is by watching the kernel
  466.        messages, or by switching on the verify (-K) option.
  467.  
  468.        The code for -F (and -f and -K ) is a complete  mess.   It
  469.        will probably work in the normal case, but don't expect it
  470.        to handle a write/verify error correctly.  If you get such
  471.        an error, best thing is to restart afio completely.
  472.  
  473. SEE ALSO
  474.        cpio(1), find(1), tar(1), compress(1), gzip(1).
  475.  
  476. AUTHORS
  477.        Mark Brukhartz ..!ihnp4!laidbak!mdb
  478.        Jeff Buhrt uunet!sawmill!prslnk!buhrt
  479.        Dave Gymer dgymer@gdcarc.co.uk
  480.        Andrew Stevens as@prg.oxford.ac.uk
  481.        Koen Holtman koen@stack.urc.tue.nl (current maintainer)
  482.        Anders Baekgaard ab@osiris.cpk.auc.dk
  483.  
  484.                                                                 9
  485.